<template>
  <div class="course-record">
    <div class="record-profile">
      <div class="pic">
        <img :src="this.$store.state.user.avatar" />
      </div>
      <div class="stuinfo">
        <div class="name">{{this.$store.state.user.name}}</div>
        <div class="stuid">{{this.$store.state.user.id}}</div>
      </div>
    </div>
    <div class="record-sign">
      <div class="title">签到</div>
      <div class="content">
        <div class="info" v-if="isShow">
          <span class="name">完成进度</span>
          <p class="proc">
            <span class="now strong">{{profile.now}}</span>
            <span class="total">/ {{profile.total}} 个</span>
          </p>
        </div>
        <div class="noInfo" v-else>暂无签到</div>
      </div>
    </div>
    <div class="record-exam">
      <div class="title">
        <div class="name">考试</div>
        <div class="detail">
          详情
          <i class="arrowRight"></i>
        </div>
      </div>
      <div class="content">
        <div class="process">
          <span class="name">完成进度</span>
          <p class="proc">
            <span class="now strong">{{profile.now}}</span>
            <span class="total">/ {{profile.total}} 个</span>
          </p>
        </div>
        <div class="average">
          <span class="name">完成进度</span>
          <p class="grade">
            <span class="score strong">{{profile.score}}</span>分
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CourseRecord',
  data() {
    return {
      isShow: true,
      profile: {
        name: '陈茂林12',
        stuid: 201820104326,
        total: 2,
        now: 1,
        score: 96.0,
      },
    };
  },
  created() {
    this._getProfileData();
  },
  methods: {
    _getProfileData() {
      let iid = this.$store.state.user.id;

      // 获取个人记录信息
      this.$http({
        url: this.$http.adornUrl(`/edu-student/student/info`),
        method: 'get',
        params: this.$http.adornParams(),
      }).then(({ data }) => {
        if (data && data.code == 20000) {
          console.log(data);
        } else {
          this.$message.error('数据获取失败');
        }
      });
    },
  },
};
</script>

<style scoped>
.course-record {
  /* width: 690px; */
  display: flex;
  flex-direction: column;
  align-items: center;
}
.course-record .record-profile {
  height: 64px;
  width: 610px;
  padding: 30px 40px;
  box-sizing: content-box;
  margin-bottom: 20px;
  border-radius: 8px;
  background-color: #fff;
  display: flex;
  align-items: center;
}
.record-profile .pic {
  height: 56px;
  width: 56px;
  border-radius: 50%;
  overflow: hidden;
}
.record-profile .pic img {
  height: 100%;
  object-fit: contain;
}
.record-profile .stuinfo {
  height: 50px;
  margin-left: 30px;
}
.stuinfo .name {
  font-size: 18px;
  font-weight: 700;
  line-height: 25px;
  color: #313133;
}
.record-profile .stuid {
  margin-top: 10px;
  color: #b8b8bf;
  line-height: 20px;
}

.course-record .record-exam,
.course-record .record-sign {
  position: relative;
  width: 650px;
  height: 116px;
  border-radius: 8px;
  margin-bottom: 20px;
  padding: 20px 20px 16px;
  box-sizing: content-box;
  background-color: #fff;
}

.record-sign .title,
.record-exam .title {
  font-weight: 700;
  color: #313133;
  line-height: 20px;
  display: flex;
  justify-content: space-between;
  margin: 0;
}
.record-exam .title .detail {
  font-weight: 400;
  margin-right: 30px;
  color: #91a0b5;
}
.record-exam .title .detail .arrowRight {
  display: inline-block;
  height: 24px;
  width: 24px;
  z-index: 10;
  vertical-align: middle;
  background: url(/src/assets/image/CourseMain/arrowRightDetail.png) no-repeat;
}

.content {
  padding-top: 10px;
  display: flex;
  justify-content: space-around;
}
.content .name {
  line-height: 20px;
  color: #646873;
}
.content p {
  font-size: 16px;
  line-height: 31px;
  margin-top: 8px;
  color: #313133;
}
.content .strong {
  font-weight: 700;
  font-size: 28px;
  font-family: serif;
}
.content .score,
.content .total {
  margin-right: 2px;
}

.record-sign .noInfo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #b8b8bf;
}
</style>